Foundations of Sampling

The Jackknife

Elizabeth King
Kevin Middleton

Sampling from data sets: foundations

  • Jackknife
  • Bootstrap
  • Randomization

What is the jackknife?

  • Invented by Quenouille and proposed by Tukey as a way to estimate confidence intervals and perform hypothesis tests when other methods don’t work
  • A way to generate a set of samples by removing one observation from your dataset at a time (“delete-one jackknife”)

The General Procedure

  1. Begin with the full dataset
  2. Remove the first value
  3. Calculate the parameter of interest pseudovalue
  4. Put the first value back and remove the second
  5. Calculate the parameter of interest pseudovalue
  6. Repeat until each value has been removed exactly one time

The result is a set of pseudovalues the same length as the original dataset

Jackknife Sampling

\[S_i = n \hat{\theta_0} - (n-1)\hat{\theta_i}\]

Jackknife Sampling

\[S_i = n\hat{\theta_0} - (n-1)\hat{\theta_i}\]

  • Each jackknife sample is a partial estimate
  • Pseudovalues are assumed to be a random sample of independent estimates
  • Turns estimation into a simple estimation of a mean and SE

An Example: Heritability

  • Heritability is the proportion of total phenotypic variance explained by variation in genetic factors
  • Heritability is estimated by using a linear model to partition the phenotypic variance and estimate these quantities
  • Several methods have been proposed as a standard error, but many have known problems

Thermal tolerance in a set of inbred lines

TT <- read_csv("Data/thermtol.csv", show_col_types = FALSE) |> 
  mutate(Line = factor(Line))
TT$incapacitation_T <- qqnorm(TT$incapacitation, plot.it = FALSE)$x
glimpse(TT)
Rows: 48,047
Columns: 3
$ Line             <fct> 11002, 11002, 11002, 11002, 11002, 11002, 11002, 1100…
$ incapacitation   <dbl> 125, 110, 130, 430, 130, 35, 255, 195, 170, 160, 135,…
$ incapacitation_T <dbl> -0.02754942, -0.19647825, 0.02655782, 2.18699773, 0.0…

Thermal tolerance in a set of inbred lines

Estimating heritability

afit <- aov(incapacitation_T ~ Line, data = TT)
summary(afit)
1
Fit ANOVA where incapacitation_T is predicted by Line
               Df Sum Sq Mean Sq F value Pr(>F)    
Line          740  12246  16.549   21.87 <2e-16 ***
Residuals   47306  35799   0.757                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Estimating heritability

suma <- unlist(summary(afit))

# Variance within groups
sw <- suma['Mean Sq2']

# Variance between groups; see Lessels and Boag (1987)
Ng <- length(unique(TT$Line))
ns <- table(TT$Line)
n0 <- (1 / (Ng - 1)) * (sum(ns) - (sum(ns^2) / sum(ns)))
sa <- (suma['Mean Sq1'] - suma['Mean Sq2']) / n0
  
#Observed Heritability
H2.0 <- sa / (sa + sw)
cat(H2.0)
0.2434952

Calculate first pseudovalue

\[S_1 = n\hat{\theta_0} - (n-1)\hat{\theta_1}\]

LineIDs <- unique(TT$Line)

# delete one line
TT.p <- TT |>
  filter(Line != LineIDs[1])

# estimate heritability
H2.p <- estH2(TT.p$incapacitation_T, TT.p$Line)
H2.p

#calculate pseudovalue
length(LineIDs)*H2.0 - (length(LineIDs) - 1)*H2.p
1
estH2() is a function that calculates heritability and returns the value
[1] 0.2436409
 Mean Sq1 
0.1356346 

Repeat for each line

pseudovals <- numeric(length=length(LineIDs))

for(ii in 1:length(LineIDs)) {
  # delete line ii
  TT.p <- TT |>
    filter(Line != LineIDs[ii])
  
  # estimate heritability
  H2.p <- estH2(TT.p$incapacitation_T, TT.p$Line)
  H2.p
  
  #calculate pseudovalue
  pseudovals[ii] <- length(LineIDs) * H2.0 - (length(LineIDs) - 1) * H2.p
}

pseudovals <- tibble(ps = pseudovals)
write_csv(pseudovals, "Data/pseudovals.csv")

Jackknife samples for heritability

Jackknife samples for heritability

Jackknife for hypothesis testing

  • Half-sibling designs are a common method for estimating heritabilities
  • Estimates from:
    • Paternal family (sire)
    • Maternal family (dam)
    • Genotypic (mean of both)
  • Are the sire and dam estimates significantly different?

Simulated Sire and Dam Heritabilities

Jackknife for hypothesis testing

  • Jackknife produces a paired set of sire and dam pseudovalues
  • Paired t-test
  • Roff (2008)1 evaluated this method via simulation
    • Appropriate false positive rate
    • False negatives are too high (low power)

Common Use Cases

  • Less often used than other methods in this module
    • Interval estimation is most common
  • Must show it is a valid approach by simulation for each use case
  • Some biological applications:
    • Quantitative genetic parameters
    • Community ecology parameters
    • Estimates of proportions